import req from './req.js';

class UserInfo{
    constructor(){

    }
    async checkOnlineStatus( token ){
        
        return await req.request({
            baseurl: process.env.VUE_APP_HOST,
            url: "/user/userstatus",
            method:"get",
            header: { 
                "Content-Type":"application/json;charset=utf-8",
                token : token }
        });

    }
}

//单例
let createUserInfo = (function(){
    window.userinfo  = null;
    return function(){
        if( window.userinfo  ){
            return window.userinfo;
        }
        return window.userinfo = new UserInfo();
    }
})();

export let uinfo = createUserInfo();